import React from 'react'
import { Consumer } from './store'

export default class Son extends React.Component {
  render() {
    return (
      <>
        <h2>孩子</h2>
        <Consumer>
          {() => (
            <div>
              <h1>111</h1>
              <h3>123123</h3>
            </div>
          )}
        </Consumer>
        <SonSon />
      </>
    )
  }
}

class SonSon extends React.Component {
  render() {
    return (
      <>
        <h3>孩子的孩子</h3>
        <Consumer>
          {(value) => {
            return <div>{JSON.stringify(value)}</div>
          }}
        </Consumer>
      </>
    )
  }
}
